//'use strict';

var QuotingToolApp = angular
    .module('QuotingToolApp', ['ngResource', 'ngRoute', 'ngAnimate', 'ngSanitize', 'ui.bootstrap', 'ui.bootstrap.contextMenu', 'smart-table', 'ngNotificationsBar', 'angular-loading-bar'])
    .config(['$locationProvider', '$routeProvider', function config($locationProvider, $routeProvider) {

        // $locationProvider.html5Mode(true);
        //$locationProvider.hashPrefix('!');

        $routeProvider
             .when('/createQuote',
            {
                templateUrl: 'templates/EditQuote.html',    //edit template used to create and edit the quote
                controller: 'QuoteController as QC'
            })
            .when('/createQuote/searchContracts',
            {
                templateUrl: 'templates/SearchContracts.html',
                controller: 'SearchContractsController as contracts'
            })
            .when('/createQuote/searchContracts/:oppid',
            {
                templateUrl: 'templates/SearchContracts.html',
                controller: 'SearchContractsController as contracts'
            })
            .when('/myQuotes',
            {
                templateUrl: 'templates/MyQuotes.html',
                controller: 'SearchMyQuotesController as myQuotes'
            })
            .when('/quotes',
            {
                templateUrl: 'templates/SearchQuotes.html',
                controller: 'SearchQuotesController as quotes'
            })
            .when('/quote/:quoteNumber',
            {
                templateUrl: 'templates/EditQuote.html',
                controller: 'QuoteController as QC'
            })
            // .when('/searchOp',
            //{
            //    templateUrl: 'templates/SearchOpportunity.html',    //edit template used to create and edit the quote
            //    controller: 'SearchOpportunityController as searchOpCtrl'
            //})


        //.otherwise({ redirectTo: '/createQuote/searchContracts' });         //replace to searchQuotes
        .otherwise({ redirectTo: '/myQuotes' });
    }])
    .config(['cfpLoadingBarProvider', function (cfpLoadingBarProvider) {

        //cfpLoadingBarProvider.parentSelector = '#loading-bar-container';
        //cfpLoadingBarProvider.spinnerTemplate = '<div><span class="fa fa-spinner">Loading...</div>';

    }])
    .config(['notificationsConfigProvider', function (notificationsConfigProvider) {

        // auto hide
        notificationsConfigProvider.setAutoHide(true);

        // delay before hide
        notificationsConfigProvider.setHideDelay(3000);

        // support HTML
        notificationsConfigProvider.setAcceptHTML(false);

        // Set an animation for hiding the notification
        notificationsConfigProvider.setAutoHideAnimation('fadeOutNotifications');

        // delay between animation and removing the nofitication
        notificationsConfigProvider.setAutoHideAnimationDelay(1200);

    }]);
    

